<template>
    <page-header-wrapper>
        <a-card :bordered="false" style="margin-bottom: 20px" title="搜索查询">
            <div class="table-page-search-wrapper">
                <a-form inline v-bind="queryFormItemLayout">
                    <a-row :gutter="20">
                        <a-col :md="12" :sm="24">
                            <a-form-item label="登录时间">
                                <div style="display:flex;align-items: center">
                                    <a-date-picker v-model="queryParam.createTime"
                                                   format="YYYY-MM-DD"
                                                   @change="handleChangeStartTime"/>
                                    <a-button style="margin-left: 10px" type="primary"
                                              @click="onSearch">
                                        查询
                                    </a-button>
                                    <a-button style="margin-left: 10px" @click="onReset">
                                        重置
                                    </a-button>
                                </div>
                            </a-form-item>
                        </a-col>
                    </a-row>
                </a-form>
            </div>
        </a-card>
        <a-card :bordered="false">
            <a-table
                :columns="columns"
                :data-source="tableData"
                :loading="tableLoading"
                :pagination="pagination"
                :rowSelection="rowSelection"
                :scroll="{ x: '100%' }"
                rowKey="id"
                @change="handleChange"
            >
            </a-table>
        </a-card>
    </page-header-wrapper>
</template>
<script>
import basic from '@/mixins/basic'
import {getLoginLog} from '@/api/api'

export default {
    mixins: [basic],
    data() {
        return {
            request: {
                page: getLoginLog
            },
            queryParam: {},
            resetQueryParam: {},
            columns: [
                {
                    title: '登陆账号',
                    dataIndex: 'username'
                },
                {
                    title: '登录IP',
                    dataIndex: 'ip'
                },
                {
                    title: '登录时间',
                    dataIndex: 'createTime'
                },
                {
                    title: '地址',
                    dataIndex: 'address'
                }
            ],
            tableData: [],
            timeDate: []
        }
    },
    methods: {
        handleChangeStartTime(value1, value2) {
            console.log(value1, value2)
            this.queryParam.createTime = value2
        }
    }
}
</script>
